package com.um.jdy.platform.station.controller;

import com.um.jdy.platform.station.entity.dto.FeePbDTO;
import com.um.jdy.platform.station.entity.vo.FeePbVO;
import com.um.jdy.platform.station.manager.*;
import com.um.springboot.starter.annotation.ApiPermission;
import com.um.springboot.starter.annotation.TokenRequired;
import com.um.springboot.starter.orm.controller.BaseController;
import com.um.springboot.starter.orm.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 方案管理
 *
 * @author cs
 * 日期 2023/5/25
 * 版权所有 广州优匠科技有限公司
 */
@Api(tags = "方案管理-充电宝方案")
@Validated
@RestController
@RequestMapping("/api/v1/cms/fee/pb")
@ApiPermission("fee_pb")
@TokenRequired
public class FeePbController extends BaseController<FeePbManager> {

    @ApiPermission("get")
    @ApiOperation(value = "详情")
    @GetMapping("/{id}")
    public Response<FeePbVO> get(@ApiParam(value = "方案id") @PathVariable String id) {
        return Response.success(manager.get(id));
    }

    @ApiPermission("add")
    @ApiOperation(value = "新增")
    @PostMapping("")
    public Response<FeePbVO> add(@RequestBody FeePbDTO feePbDTO) {
        return Response.success(manager.add(feePbDTO));
    }

    @ApiPermission("update")
    @ApiOperation(value = "编辑")
    @PutMapping("{id}")
    public Response<FeePbVO> update(@ApiParam(value = "方案id") @PathVariable String id,
                                    @RequestBody FeePbDTO feePbDTO) {
        return Response.success(manager.update(id, feePbDTO));
    }

}
